package com.bazhahei.ctrls.controllers;

import com.alibaba.dubbo.config.annotation.Reference;
import com.bazhahei.commons.entity.Student;
import com.bazhahei.services.service.StudService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class IndexController {

    @Reference(version = "1.0.0")
    private StudService studService;


    @RequestMapping("/index")
    @ResponseBody
    public String index(){
        System.out.println(studService);
        Student student = new Student();
        student.setName("alibaba");
        student.setAge(18);
        student = studService.save(student);
        return "ok "+student.getId();
    }
}
